package com.ruoyi.web.controller.market.special;

import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.db.domain.SpecialDataStarAddupInfo;
import com.ruoyi.special.service.ISpecialDataStarAddupInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.wapper.SpecialDataStarAddupInfoWapper;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 机构星级回传详情信息Controller
 * 
 * @author ruoyi
 * @date 2024-11-11
 */
@Controller
@RequestMapping("/special/startAddupInfo")
public class SpecialDataStarAddupInfoController extends BaseController
{
    private String prefix = "special/startAddupInfo";

    @Autowired
    private ISpecialDataStarAddupInfoService specialDataStarAddupInfoService;

//    @RequiresPermissions("special:startAddupInfo:view")
    @GetMapping("/{infoId}")
    public String startAddupInfo(@PathVariable("infoId") String costomId, ModelMap mmap)
    {
        mmap.put("infoId", costomId);
        return prefix + "/startAddupInfo";
    }

    /**
     * 查询机构星级回传详情信息列表
     */
//    @RequiresPermissions("special:startAddupInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SpecialDataStarAddupInfo specialDataStarAddupInfo)
    {
        startPage();
        List<Map<String, Object>> mapList = specialDataStarAddupInfoService.selectSpecialDataStarAddupInfoListMap(specialDataStarAddupInfo);
        mapList = new SpecialDataStarAddupInfoWapper(mapList).wrap();
        return getDataTable(mapList);
    }

    /**
     * 导出机构星级回传详情信息列表
     */
    @RequiresPermissions("special:startAddupInfo:export")
    @Log(title = "机构星级回传详情信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SpecialDataStarAddupInfo specialDataStarAddupInfo)
    {
        List<SpecialDataStarAddupInfo> list = specialDataStarAddupInfoService.selectSpecialDataStarAddupInfoList(specialDataStarAddupInfo);
        ExcelUtil<SpecialDataStarAddupInfo> util = new ExcelUtil<SpecialDataStarAddupInfo>(SpecialDataStarAddupInfo.class);
        return util.exportExcel(list, "机构星级回传详情信息数据");
    }

    /**
     * 新增机构星级回传详情信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存机构星级回传详情信息
     */
    @RequiresPermissions("special:startAddupInfo:add")
    @Log(title = "机构星级回传详情信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(SpecialDataStarAddupInfo specialDataStarAddupInfo)
    {
        return toAjax(specialDataStarAddupInfoService.insertSpecialDataStarAddupInfo(specialDataStarAddupInfo));
    }

    /**
     * 修改机构星级回传详情信息
     */
    @RequiresPermissions("special:startAddupInfo:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        SpecialDataStarAddupInfo specialDataStarAddupInfo = specialDataStarAddupInfoService.selectSpecialDataStarAddupInfoById(id);
        mmap.put("specialDataStarAddupInfo", specialDataStarAddupInfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存机构星级回传详情信息
     */
    @RequiresPermissions("special:startAddupInfo:edit")
    @Log(title = "机构星级回传详情信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(SpecialDataStarAddupInfo specialDataStarAddupInfo)
    {
        return toAjax(specialDataStarAddupInfoService.updateSpecialDataStarAddupInfo(specialDataStarAddupInfo));
    }

    /**
     * 删除机构星级回传详情信息
     */
    @RequiresPermissions("special:startAddupInfo:remove")
    @Log(title = "机构星级回传详情信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(specialDataStarAddupInfoService.deleteSpecialDataStarAddupInfoByIds(ids));
    }
}
